Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable GPIO Pin Interrupts #1922

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Enable GPIO Pin Interrupts #1922

wants to merge 4 commits into from

Conversation

lzrd
Copy link
Contributor

@lzrd lzrd commented Nov 18, 2024

Add interrupt-related API calls to the LPC55 gpio_driver.

Also:
Fix app/gimletlet/app-mgmt.toml stack size which was found while building all targets.


A task on an LPC55 can now configue and use GPIO interrupts.

app.toml example shows Pin Interrupt configuration:

[tasks.foo]
...
interrupts = { "pint.irq0" = "button-irq" }
...
task-slots = ["gpio_driver", ...]

[tasks.foo.config]
pins = [
{ name="BUTTON', pin={ port=1, pin=9}, alt=0, pint=0, direction="input", opendrain="normal" }
]

@lzrd lzrd force-pushed the lpc55-gpio-interrupts branch 2 times, most recently from ddf4058 to 8565d73 Compare November 19, 2024 03:19
drv/lpc55-gpio/src/main.rs Outdated Show resolved Hide resolved
writeln!(&mut buf, "#[allow(unused)]")?;
writeln!(
&mut buf,
"pub const {}_PINT_MASK: u32 = 1 << {};",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Passing the raw mask around doesn't seem right and you have a comment below about wanting to validate the mask. Can we pass the PintSlot enum around instead? That should always be valid.

build/lpc55pins/src/lib.rs Outdated Show resolved Hide resolved
@lzrd lzrd force-pushed the lpc55-gpio-interrupts branch from 8565d73 to 70ecce9 Compare November 26, 2024 03:47
lzrd added 4 commits December 12, 2024 15:08
Add interrupt-related API calls to the LPC55 `gpio_driver`.

A task on an LPC55 can now configue and use GPIO interrupts.

app.toml example shows Pin Interrupt configuration:

[tasks.foo]
...
interrupts = { "pint.irq0" = "button-irq" }
...
task-slots = ["gpio_driver", ...]

[tasks.foo.config]
pins = [
  { name="BUTTON', pin={ port=1, pin=9}, alt=0, pint=0, direction="input", opendrain="normal" }
]
…API.

The functions:

fn {clear,detected,disable,enable}_{rising,falling,status}(PintSlot)
and
fn read_pint_status(...)

become

fn pint_op(PintSlot, PintOp, PintCondition)

This leaves a couple permutations not covered (enable/disable
interrupt at the NVIC level).
Those can are left as no-ops for the time being.

Future: The unimplemented combinations could return an error/fault
if called.
…EADME.md

Feedback response: Fix idl/lpc55-pins.idol to use Option<PintSlot>.
Feedback response: Collapse the many PINT calls in lpc55-pins.idol to one `pint_op`
@lzrd lzrd force-pushed the lpc55-gpio-interrupts branch from 70ecce9 to 77e17fd Compare December 13, 2024 00:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants